--rob_opr_base.alert = 1

function rob_opr_base.adjust_alert_level(name, value)
   local amount = tonumber(value)
   if amount then
      local player = minetest.get_player_by_name(name)
      local pos = player:get_pos()
      local alert = rob_opr_base.alert
      local new_alert = alert + amount
      if new_alert >= 5 and new_alert <= 7 then
         rob_opr_base.send_cleaners(pos)
      elseif new_alert >= 10 and new_alert <= 12 then
         rob_opr_base.send_cleaners(pos)
      elseif new_alert >= 15 and new_alert <= 17 then
         rob_opr_base.send_cleaners(pos)
      elseif new_alert >= 20 and new_alert <= 22 then
         rob_opr_base.trigger_alarm(pos)
      elseif new_alert >= 25 and new_alert <= 27 then
         rob_opr_base.trigger_alarm(pos)
      elseif new_alert >= 40 then
         minetest.clear_objects('quick')
         minetest.show_formspec(name, 'end_screen', rob_opr_base.end_game_lose)
      end
      rob_opr_base.alert = new_alert
   end
end
